﻿<%@ Page Title="Quản lí phòng ban" Language="C#" MasterPageFile="~/Views/MasterPageViews.master" AutoEventWireup="true" CodeFile="Departments.aspx.cs" Inherits="Views_Departments" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>

<asp:Content ID="ContentHeader" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="ContentChange" ContentPlaceHolderID="ContentPlaceHolderChange" runat="Server">
    <h3 class="header-title">
        <ext:Label StyleHtmlCls="lable-message" StyleHtmlContent="true" ID="lblHeader" runat="server" Text="Quản lí phòng ban"
            Icon="ApplicationFormMagnify" />
    </h3>
    <div class="content-sub">
        <ext:Toolbar ID="ToolbarFunctions" runat="server">
            <Items>
                <ext:Button ID="btnToobarAdd" runat="server" Text="Thêm mới" Icon="Add" OnDirectClick="btnToobarAdd_DirectClick" />
                <ext:Button ID="btnToobarUpdate" runat="server" Text="Chỉnh sửa" Icon="Pencil" OnDirectClick="btnToobarUpdate_DirectClick" />
                <ext:Button ID="btnToobarDelete" runat="server" Text="Xóa" Icon="Delete" OnDirectClick="btnToobarDelete_DirectClick" />
                <ext:Button ID="btnToobarHelp" runat="server" Text="Hỗ trợ" Icon="Help" />
            </Items>
        </ext:Toolbar>
        <ext:Store
            ID="StoreDepartment"
            runat="server"
            OnReadData="StoreDepartment_ReadData"
            PageSize="10">
            <Model>
                <ext:Model ID="ModelDepartment" runat="server" IDProperty="DepID">
                    <Fields>
                        <ext:ModelField Name="DepID" />
                        <ext:ModelField Name="CodeOfDep" />
                        <ext:ModelField Name="NameOfDep" />
                        <ext:ModelField Name="Descriptons" />
                        <ext:ModelField Name="StatusOfDep" Type="Boolean" />
                        <ext:ModelField Name="NameOfOrgan" />
                        <ext:ModelField Name="NameOfComm" />
                        <ext:ModelField Name="NameOfDist" />
                        <ext:ModelField Name="NameOfProvince" />
                    </Fields>
                </ext:Model>
            </Model>
        </ext:Store>
        <!----------------->
        <!--Grid province-->
        <ext:GridPanel
            ID="GridPanelDepartment"
            runat="server"
            StoreID="StoreDepartment"
            Title="Danh sách phòng ban"
            Height="300"
            Split="true"
            AutoScroll="True">
            <ColumnModel ID="ColumnModelDepartment" runat="server">
                <Columns>
                    <ext:Column ID="Col_ID" runat="server" Text="ID" DataIndex="DepID" Hidden="false" />
                    <ext:Column ID="Col_Code" runat="server" Text="Mã phòng ban" DataIndex="CodeOfDep" />
                    <ext:Column ID="Col_NameOfDep" runat="server" Text="Tên phòng ban" DataIndex="NameOfDep" Flex="1" />
                    <ext:Column ID="Col_Des" runat="server" Text="Mô tả" DataIndex="Descriptons" />
                    <ext:CheckColumn ID="Col_Status" runat="server" Text="Trạng thái" DataIndex="StatusOfDep" />

                    <ext:Column ID="Col_NameOfOrgan" runat="server" Text="Cơ quan" DataIndex="NameOfOrgan" />
                    <ext:Column ID="Col_NameOfComm" runat="server" Text="Xã phường" DataIndex="NameOfComm" />
                    <ext:Column ID="Col_NameOfDist" runat="server" Text="Quận huyện" DataIndex="NameOfDist" />
                    <ext:Column ID="Col_ProvinceName" runat="server" Text="Tỉnh thành" DataIndex="NameOfProvince" />
                </Columns>
            </ColumnModel>

            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModelDepartment" runat="server" Mode="Single">
                    <DirectEvents>
                        <Select OnEvent="RowSelect" Buffer="250" />
                    </DirectEvents>
                </ext:RowSelectionModel>
            </SelectionModel>
            <BottomBar>
                <ext:PagingToolbar ID="PagingToolbarDepartment" runat="server" StoreID="StoreDepartment" BeforePageText="Trang"
                    EmptyMsg="Chưa có dữ liệu" AfterPageText="trên  {0}"
                    DisplayMsg="Hiển thị bản ghi {0} - {1} trên tổng số {2}" RefreshText="Làm mới" LastText="Trang cuối"
                    NextText="Trang kế" PrevText="Trang trước" FirstText="Trang đầu" />
            </BottomBar>
        </ext:GridPanel>
        <!--------------------->
    </div>

    <div class="view-info-record">
        <h3 class="header-title">
            <ext:Label StyleHtmlCls="lable-message" StyleHtmlContent="true" ID="lblDistHead" runat="server" Text="Hiển thị thông tin của phòng ban"
                Icon="Information" />
        </h3>
        <div class="content-info">
            <table>
                <tr>
                    <td class="with-td-view-info">Mã :</td>
                    <td>
                        <ext:Label ID="lblViewCodeDepart" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Tên phòng ban :</td>
                    <td>
                        <ext:Label ID="lblViewNameDepart" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Mô tả :</td>
                    <td>
                        <ext:Label ID="lblViewDesDepart" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Thuộc cơ quan :</td>
                    <td>
                        <ext:Label ID="lblViewOrganization" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Thuộc xã phường :</td>
                    <td>
                        <ext:Label ID="lblViewCommune" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Quận huyện :</td>
                    <td>
                        <ext:Label ID="lblViewDistrict" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Tỉnh thành :</td>
                    <td>
                        <ext:Label ID="lblViewProvince" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="with-td-view-info">Trạng thái:</td>
                    <td>
                        <ext:Checkbox ID="chkViewDistStatus" runat="server" />
                    </td>
                </tr>
            </table>
        </div>
    </div>

    <!-- Cửa sổ popup thêm mới cơ quan -->
    <ext:Window
        ID="WindownAdd"
        runat="server"
        Title="Thêm mới phòng ban"
        Icon="ApplicationAdd"
        Height="355"
        Width="350"
        BodyStyle="background-color: #fff;"
        Modal="true"
        ShadowMode="Drop"
        Hidden="true">
        <Content>
            <ext:Toolbar ID="ToolbarAdd" runat="server">
                <Items>
                    <ext:Button ID="menuItemAdd" runat="server" Text="Lưu lại" Icon="DiskBlack" OnDirectClick="menuItemAdd_DirectClick" />
                    <ext:Button ID="btnAddCancel" runat="server" Text="Hủy bỏ" Icon="Delete" OnDirectClick="btnAddCancel_DirectClick" />
                </Items>
            </ext:Toolbar>
            <div class="content-popup-style">
                <div class="view-msg-popup">
                    <ext:Label ID="lblFormAddMsg" runat="server" StyleHtmlContent="True" Cls="lable-message-error" />
                </div>
                <div>
                    <!-- Selectbox provinces --->
                    <ext:SelectBox
                        ID="cbxProvinces"
                        runat="server"
                        DisplayField="NameOfProvince"
                        ValueField="ProvID"
                        EmptyText="Lựa chọn"
                        FieldLabel="Tỉnh thành"
                        Width="310"
                        MarginSpec="5 0 5 0">
                        <Store>
                            <ext:Store ID="storeProvince" runat="server">
                                <Model>
                                    <ext:Model ID="modelProvince" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="ProvID" />
                                            <ext:ModelField Name="NameOfProvince" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Listeners>
                            <Select Handler="App.direct.cbxProvinces_SelectedChange();" />
                        </Listeners>
                    </ext:SelectBox>
                    <!--------------------->

                    <!-- Selectbox districts --->
                    <ext:SelectBox
                        ID="cbxDistrict"
                        runat="server"
                        DisplayField="NameOfDist"
                        ValueField="DistID"
                        EmptyText="Lựa chọn"
                        FieldLabel="Quận huyện"
                        Width="310"
                        MarginSpec="5 0 5 0">
                        <Store>
                            <ext:Store ID="StoreDistrict" runat="server">
                                <Model>
                                    <ext:Model ID="ModelDistrict" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="DistID" />
                                            <ext:ModelField Name="NameOfDist" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Listeners>
                            <Select Handler="App.direct.cbxDistrict_SelectedChange();" />
                        </Listeners>
                    </ext:SelectBox>
                    <!--------------------->

                    <!-- Selectbox Communes --->
                    <ext:SelectBox
                        ID="cbxCommune"
                        runat="server"
                        DisplayField="NameOfComm"
                        ValueField="ComID"
                        EmptyText="Lựa chọn"
                        FieldLabel="Xã phường"
                        Width="310"
                        MarginSpec="5 0 5 0">
                        <Store>
                            <ext:Store ID="StoreCommune" runat="server">
                                <Model>
                                    <ext:Model ID="ModelCommune" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="ComID" />
                                            <ext:ModelField Name="NameOfComm" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                        <Listeners>
                            <Select Handler="App.direct.cbxCommune_SelectedChange();" />
                        </Listeners>
                    </ext:SelectBox>
                    <!--------------------->

                    <!-- Selectbox Organization --->
                    <ext:SelectBox
                        ID="cbxOrganization"
                        runat="server"
                        DisplayField="NameOfOrgan"
                        ValueField="OrgID"
                        EmptyText="Lựa chọn"
                        FieldLabel="Cơ quan"
                        Width="310"
                        MarginSpec="5 0 5 0">
                        <Store>
                            <ext:Store ID="StoreOrganization" runat="server">
                                <Model>
                                    <ext:Model ID="ModelOrganization" runat="server">
                                        <Fields>
                                            <ext:ModelField Name="OrgID" />
                                            <ext:ModelField Name="NameOfOrgan" />
                                        </Fields>
                                    </ext:Model>
                                </Model>
                            </ext:Store>
                        </Store>
                    </ext:SelectBox>
                    <!--------------------->
                    <ext:TextField ID="txtFormAddCodeDepartment" runat="server" FieldLabel="Mã phòng ban" Width="310" MarginSpec="5 0 5 0" />
                    <ext:TextField ID="txtFormAddNameDepartment" runat="server" FieldLabel="Tên phòng ban" Width="310" MarginSpec="5 0 5 0" />
                    <ext:TextArea ID="txtFormAddDes" runat="server" FieldLabel="Mô tả" Width="310" MarginSpec="5 0 5 0" />
                    <ext:Checkbox ID="chkFormAddStatus" runat="server" FieldLabel="Trạng thái" BoxLabel="Cho phép hoạt động" />
                </div>
            </div>
        </Content>
    </ext:Window>
    <!-----end------->

    <!-- Cửa sổ popup cập nhật thông tin cơ quan -->
    <ext:Window
        ID="WindowUpdate"
        runat="server"
        Title="Thêm mật thông tin phòng ban"
        Icon="ApplicationEdit"
        Height="355"
        Width="350"
        BodyStyle="background-color: #fff;"
        Modal="true"
        ShadowMode="Drop"
        Hidden="true">
        <Content>
            <ext:Toolbar ID="ToolbarUpdate" runat="server">
                <Items>
                    <ext:Button ID="btnUpdateSave" runat="server" Text="Cập nhật" Icon="Disk" OnDirectClick="btnUpdateSave_DirectClick" />
                    <ext:Button ID="btnUpdateCacel" runat="server" Text="Hủy bỏ" Icon="Delete" OnDirectClick="btnUpdateCacel_DirectClick" />
                </Items>
            </ext:Toolbar>
            <div class="content-popup-style">
                <div class="view-msg-popup">
                    <ext:Label ID="lblUpdateMsg" runat="server" StyleHtmlContent="True" Cls="lable-message-error" />
                </div>
                <div>
                    <ext:TextField ID="txtUpdatePro" runat="server" FieldLabel="Tỉnh thành" Width="310" MarginSpec="5 0 5 0" Disabled ="true" />
                    <ext:TextField ID="txtUpdateDist" runat="server" FieldLabel="Quận huyện" Width="310" MarginSpec="5 0 5 0" Disabled ="true" />
                    <ext:TextField ID="txtUpdateComm" runat="server" FieldLabel="Xã phường" Width="310" MarginSpec="5 0 5 0" Disabled ="true" />
                    <ext:TextField ID="txtUpdateOrg" runat="server" FieldLabel="Cơ quan" Width="310" MarginSpec="5 0 5 0" Disabled ="true" />

                    <ext:TextField ID="txtUpdateCode" runat="server" FieldLabel="Mã phòng ban" Width="310" MarginSpec="5 0 5 0" />
                    <ext:TextField ID="txtUpdateName" runat="server" FieldLabel="Tên phòng ban" Width="310" MarginSpec="5 0 5 0" />
                    <ext:TextArea ID="txtUpdateDes" runat="server" FieldLabel="Mô tả" Width="310" MarginSpec="5 0 5 0" />
                    <ext:Checkbox ID="chkUpdateStatus" runat="server" FieldLabel="Trạng thái" BoxLabel="Cho phép hoạt động" />
                </div>
            </div>
        </Content>
    </ext:Window>
    <!-----end------->
</asp:Content>

